package storage;

import java.util.logging.Logger;

public class UndoRedoDetails implements Cloneable {
	private String lastCommand_;
	private int id_;
	private Task task_;
	private String fieldOfChange_;
	private Object initialValue_;
	private Object newValue_;
	private final static Logger LOGGER = Logger.getLogger(UndoRedoDetails.class
			.getName());

	public UndoRedoDetails() {
		lastCommand_ = "";
		id_ = -1;
		task_ = null;
		fieldOfChange_ = "";
		initialValue_ = "";
	}

	public UndoRedoDetails setDetails(String lastCommand, int id, Task task,
			String fieldOfChange, Object initialValue, Object newValue) {
		this.lastCommand_ = lastCommand;
		this.id_ = id;
		this.task_ = task;
		this.fieldOfChange_ = fieldOfChange;
		this.initialValue_ = initialValue;
		this.newValue_ = newValue;

		return this.getDetails();
	}

	public String getCommand() {
		return this.lastCommand_;
	}

	public int getId() {
		return this.id_;
	}

	public Task getTask() {
		return this.task_;
	}

	public String getEditingField() {
		return this.fieldOfChange_;
	}

	public Object getInitialValue() {
		return this.initialValue_;
	}

	public Object getNewValue() {
		return this.newValue_;
	}

	private UndoRedoDetails getDetails() {
		return this;
	}

	public void setCommand(String newCommand) {
		this.lastCommand_ = newCommand;
	}

	public void setId(int id) {
		this.id_ = id;
	}

	public void setTask(Task task) {
		this.task_ = task;
	}

	public void setEditingField(String field) {
		this.fieldOfChange_ = field;
	}

	public void setInitialValue(Object initialValue) {
		this.initialValue_ = initialValue;
	}

	public void setNewValue(Object newValue) {
		this.newValue_ = newValue;
	}

	public Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			return null;
		}
	}
}
